<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="pessoa" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{pessoaHome.managed ? 'Edit' : 'Add'} Pessoa</f:facet>



            <s:decorate id="usuarioIdUsuarioField" template="layout/edit.xhtml">
                <ui:define name="label">Usuario</ui:define>
                <h:inputText id="usuarioUsername"
                       required="true"
                          value="#{pessoaHome.instance.usuarioUsername}">
                    <a:support event="onblur" reRender="usuarioIdUsuarioField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="contaIdContaField" template="layout/edit.xhtml">
                <ui:define name="label">Conta id conta</ui:define>
                <h:inputText id="contaIdConta"
                       required="true"
                          value="#{pessoaHome.instance.contaIdConta}">
                    <a:support event="onblur" reRender="contaIdContaField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="nomeField" template="layout/edit.xhtml">
                <ui:define name="label">Nome</ui:define>
                <h:inputText id="nome"
                           size="80"
                      maxlength="80"
                          value="#{pessoaHome.instance.nome}">
                    <a:support event="onblur" reRender="nomeField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="enderecoField" template="layout/edit.xhtml">
                <ui:define name="label">Endereco</ui:define>
                <h:inputTextarea id="endereco"
                               cols="80"
                               rows="3"
                              value="#{pessoaHome.instance.endereco}"/>
            </s:decorate>


            <s:decorate id="bairroField" template="layout/edit.xhtml">
                <ui:define name="label">Bairro</ui:define>
                <h:inputText id="bairro"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.bairro}">
                    <a:support event="onblur" reRender="bairroField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="complementoField" template="layout/edit.xhtml">
                <ui:define name="label">Complemento</ui:define>
                <h:inputText id="complemento"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.complemento}">
                    <a:support event="onblur" reRender="complementoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="cidadeField" template="layout/edit.xhtml">
                <ui:define name="label">Cidade</ui:define>
                <h:inputText id="cidade"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.cidade}">
                    <a:support event="onblur" reRender="cidadeField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="ufField" template="layout/edit.xhtml">
                <ui:define name="label">Uf</ui:define>
                <h:inputText id="uf"
                           size="2"
                      maxlength="2"
                          value="#{pessoaHome.instance.uf}">
                    <a:support event="onblur" reRender="ufField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="dddtelefoneField" template="layout/edit.xhtml">
                <ui:define name="label">Dddtelefone</ui:define>
                <h:inputText id="dddtelefone"
                           size="3"
                      maxlength="3"
                          value="#{pessoaHome.instance.dddtelefone}">
                    <a:support event="onblur" reRender="dddtelefoneField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="telefoneField" template="layout/edit.xhtml">
                <ui:define name="label">Telefone</ui:define>
                <h:inputText id="telefone"
                           size="9"
                      maxlength="9"
                          value="#{pessoaHome.instance.telefone}">
                    <a:support event="onblur" reRender="telefoneField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="dddcelularField" template="layout/edit.xhtml">
                <ui:define name="label">Dddcelular</ui:define>
                <h:inputText id="dddcelular"
                           size="3"
                      maxlength="3"
                          value="#{pessoaHome.instance.dddcelular}">
                    <a:support event="onblur" reRender="dddcelularField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="celularField" template="layout/edit.xhtml">
                <ui:define name="label">Celular</ui:define>
                <h:inputText id="celular"
                           size="9"
                      maxlength="9"
                          value="#{pessoaHome.instance.celular}">
                    <a:support event="onblur" reRender="celularField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="rgField" template="layout/edit.xhtml">
                <ui:define name="label">Rg</ui:define>
                <h:inputText id="rg"
                           size="12"
                      maxlength="12"
                          value="#{pessoaHome.instance.rg}">
                    <a:support event="onblur" reRender="rgField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="sspField" template="layout/edit.xhtml">
                <ui:define name="label">Ssp</ui:define>
                <h:inputText id="ssp"
                           size="20"
                      maxlength="20"
                          value="#{pessoaHome.instance.ssp}">
                    <a:support event="onblur" reRender="sspField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="cpfcnpjField" template="layout/edit.xhtml">
                <ui:define name="label">Cpfcnpj</ui:define>
                <h:inputText id="cpfcnpj"
                           size="15"
                      maxlength="15"
                          value="#{pessoaHome.instance.cpfcnpj}">
                    <a:support event="onblur" reRender="cpfcnpjField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="profissaoField" template="layout/edit.xhtml">
                <ui:define name="label">Profissao</ui:define>
                <h:inputText id="profissao"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.profissao}">
                    <a:support event="onblur" reRender="profissaoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="nacionalidadeField" template="layout/edit.xhtml">
                <ui:define name="label">Nacionalidade</ui:define>
                <h:inputText id="nacionalidade"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.nacionalidade}">
                    <a:support event="onblur" reRender="nacionalidadeField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="estadocivilField" template="layout/edit.xhtml">
                <ui:define name="label">Estadocivil</ui:define>
                <h:inputText id="estadocivil"
                           size="100"
                      maxlength="100"
                          value="#{pessoaHome.instance.estadocivil}">
                    <a:support event="onblur" reRender="estadocivilField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="emailField" template="layout/edit.xhtml">
                <ui:define name="label">Email</ui:define>
                <h:inputText id="email"
                           size="100"
                      maxlength="120"
                          value="#{pessoaHome.instance.email}">
                    <a:support event="onblur" reRender="emailField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="outrosField" template="layout/edit.xhtml">
                <ui:define name="label">Outros</ui:define>
                <h:inputText id="outros"
                          value="#{pessoaHome.instance.outros}">
                    <a:support event="onblur" reRender="outrosField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{pessoaHome.persist}"
                       disabled="#{!pessoaHome.wired}"
                       rendered="#{!pessoaHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{pessoaHome.update}"
                       rendered="#{pessoaHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{pessoaHome.remove}"
                      immediate="true"
                       rendered="#{pessoaHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Pessoa.xhtml"
                rendered="#{pessoaHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty pessoaFrom ? 'PessoaList' : pessoaFrom}.xhtml"
                rendered="#{!pessoaHome.managed}"/>

        </div>
    </h:form>

</ui:define>

</ui:composition>
